import axios from 'axios'

const service = axios.create({
  baseURL: 'https://book.youbaobao.xyz:18082',
  timeout: 5000
})

service.interceptors.response.use(
  (res) => {
    if (res.status === 200 && res.data) {
      // console.log(res.data)
      return res.data
    } else {
      return Promise.reject(new Error('请求失败'))
    }
  },
  (error) => {
    return Promise.reject(error)
  }
)

export default service
